﻿@using BootstrapBlazor.Shared.Samples;
@inject IStringLocalizer<Foo> LocalizerFoo
@inject IStringLocalizer<LabelsValidateForm1> Localizer

<div>
    <p>@((MarkupString)Localizer["LabelsValidateForm1Description1"].Value)</p>

    <GroupBox>
        <ValidateForm Model="@Dummy">
            <EditorForm TModel="Foo" RowType="RowType.Inline" ItemsPerRow="2">
                <FieldItems>
                    <EditorItem @bind-Field="context.Hobby" Items="@Foo.GenerateHobbys(LocalizerFoo)">
                    </EditorItem>
                </FieldItems>
            </EditorForm>
        </ValidateForm>
    </GroupBox>

    <p class="mt-3">@((MarkupString)Localizer["LabelsValidateForm1Description2"].Value)</p>
    <GroupBox>
        <ValidateForm Model="@Dummy" ShowLabel="false">
            <EditorForm TModel="Foo" RowType="RowType.Inline" ItemsPerRow="2">
                <FieldItems>
                    <EditorItem @bind-Field="context.Hobby" Items="@Foo.GenerateHobbys(LocalizerFoo)">
                    </EditorItem>
                </FieldItems>
            </EditorForm>
        </ValidateForm>
    </GroupBox>
</div>

@code {
    [NotNull]
    private Foo? Dummy { get; set; }

    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Dummy = Foo.Generate(LocalizerFoo);
    }
}
